package com.emokili.ewa.core.frame.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.emokili.ewa.core.frame.dao.FeedBackDao;
import com.emokili.ewa.core.frame.dao.FrameModelDao;
import com.emokili.ewa.core.frame.entity.FeedBackEntity;
import com.emokili.ewa.core.frame.entity.FrameModelEntity;
import com.emokili.ewa.core.frame.entity.MemberFrameEntity;
import com.emokili.ewa.core.frame.service.FeedBackService;
import com.emokili.ewa.core.frame.service.FrameModelService;
import com.emokili.ewa.core.frame.service.MemberFrameService;
import com.emokili.ewa.core.frame.vo.FeedBackVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
@Service
public class FeedBackServiceImpl extends ServiceImpl<FeedBackDao, FeedBackEntity> implements FeedBackService {

    @Autowired
    private MemberFrameService memberFrameService;

    @Override
    public void feedBack(FeedBackVo feedBackVo) {
        MemberFrameEntity memberFrameEntity = new MemberFrameEntity();
        memberFrameEntity.setSerialNumber(feedBackVo.getSerialNumber());
        MemberFrameEntity one = memberFrameService.getOne(new QueryWrapper<>(memberFrameEntity));
        FeedBackEntity feedBackEntity = new FeedBackEntity();
        BeanUtils.copyProperties(feedBackVo,feedBackEntity);
        feedBackEntity.setMemberId(one.getMemberId());
        feedBackEntity.setCreateTime(new Date());
        feedBackEntity.setShowStatus(1);
        saveOrUpdate(feedBackEntity);
    }
}
